import { one } from '../mutation-types'
const state = () => ({
	lang: 's',
	userId: 'aaa',
	index: 1,
	arr: [1, 2, 3, 4, 5, 6, 7]
})
const getters = {
	getUserId(state, getters) {
		console.log(getters.getLang)
		return state.index
	},
	getLang(state) {
		return state.lang + 'ooo'
	},
	getArr: state => num => {
		return state.arr.filter(e => e <= num)
	}
}
const mutations = {
	addIndex(state, p) {
		state.index += p
		console.log(state.index)
		console.log(p)
	},
	[one](state, payload) {
		state.arr.push(payload)
		console.log(state.arr)
	}
}
const actions = {
	asyncAddIndex() {},
	increment({ commit }, p) {
		commit('addIndex', p)
	}
}
export default {
	namespaced: true,
	state,
	getters,
	mutations,
	actions
}
